package com.mlegrand.firestarter.model
{
	import com.adobe.cairngorm.CairngormError;
	import com.adobe.cairngorm.CairngormMessageCodes;
	import com.adobe.cairngorm.model.ModelLocator;
	import com.mlegrand.firestarter.managers.ApplicationNavigationManager;
	import com.mlegrand.firestarter.managers.ProjectBuilderManager;
	
	
	[Bindable]
	public class ApplicationModel implements ModelLocator
	{
		private static var instance : ApplicationModel;

		////////////////////////////////////////////////////////////////////////////
		// properties
		////////////////////////////////////////////////////////////////////////////

		public var applicationNavigationManager:ApplicationNavigationManager;
		public var debug:Boolean //= true;
		public var projectBuilderManager:ProjectBuilderManager;

		////////////////////////////////////////////////////////////////////////////
		// constructor
		////////////////////////////////////////////////////////////////////////////

		public function ApplicationModel()
		{   
			if ( instance != null )
			{
				throw new CairngormError(CairngormMessageCodes.SINGLETON_EXCEPTION, "ShopModelLocator" );
			}
			instance = this;
			
			//
			// Instantiate manager classes
			// 
			applicationNavigationManager = new ApplicationNavigationManager();
			projectBuilderManager = new ProjectBuilderManager()
		}
		
		////////////////////////////////////////////////////////////////////////////
		// static methods
		////////////////////////////////////////////////////////////////////////////
		
		
		public static function getInstance() : ApplicationModel 
		{
			if ( instance == null )
				instance = new ApplicationModel();
			
			return instance;
		}
		
	}
}